package org.eweb4j.solidbase.role.util;

import org.eweb4j.solidbase.permission.model.Permission;
import org.eweb4j.solidbase.role.model.Role;

public class RoleUtil {
	public static void setPermission(final long[] permissionIds, final Role role) {
		if (permissionIds != null && permissionIds.length > 0) {
			for (long permId : permissionIds) {
				Permission perm = new Permission();
				perm.setPermId(permId);
				role.getPermissions().add(perm);
			}
		} else {
			role.setPermissions(null);
		}
	}
}
